var Fly=require("flyio/dist/npm/wx") 
var fly=new Fly
fly.config.headers = {Accept:"application/json"}

import { clearUserInfo } from './login'
// Add a request interceptor
fly.interceptors.request.use((request)=>{
    // Do something before request is sent
    // Complete the request with custom data
    // return Promise.resolve("fake data")
})
fly.interceptors.response.use((response)=>{
    
}, err => {
    if(err.status === 0){
        wx.showToast({
            icon: 'none',
            title: '网络错误，请检查网络~'
        })
    }
    if(err.status === 401){
        wx.navigateTo({
        url: '/pages/login/main'
      })
    }
})

export default fly